package com.awspaas.user.apps.shhtaerospaceindustrial.event;
import java.util.List;
import java.util.Map;
import com.actionsoft.bpms.bpmn.engine.core.delegate.ProcessExecutionContext;
import com.actionsoft.bpms.bpmn.engine.listener.InterruptListenerInterface;
import com.actionsoft.bpms.commons.database.ColumnMapRowMapper;
import com.actionsoft.bpms.util.DBSql;
import com.actionsoft.exception.BPMNError;
import com.awspaas.user.apps.shhtaerospaceindustrial.util.CoreUtil;
public class validateUnitPsnYxmydCpStep1 implements InterruptListenerInterface{
	@Override
	public boolean execute(ProcessExecutionContext processExecutionContext) throws Exception {
		String processInstId = processExecutionContext.getProcessInstance().getId();
		List<Map<String, Object>> userinfolist = DBSql.query("SELECT * FROM BO_EU_MYD_CEPING_BODY WHERE BINDID = ? ", new ColumnMapRowMapper(), new Object[] {processInstId});
		if(userinfolist == null || userinfolist.isEmpty()) {
			throw new BPMNError("测评项目明细为空");
		}
//		List<String> certlist=new ArrayList<String>();
		
		for (Map<String, Object> map : userinfolist) {
			
			String MANYIDU = CoreUtil.objToStr(map.get("MANYIDU"));
			
			String CEPINGTYPE = CoreUtil.objToStr(map.get("CEPINGTYPE"));
			
			if("".equals(MANYIDU)) {
				throw new BPMNError(CEPINGTYPE+"->"+"满意程度未选择，请选择后提交！");
			}			

			}
		
		
		return true;
	}

	@Override
	public String getDescription() {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public String getProvider() {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public String getVersion() {
		// TODO Auto-generated method stub
		return null;
	}
}
